if bash.found()
test_env = environment()
- foreach t : ['simplify', 'simplify-3to4', 'settings']
+ foreach t : ['simplify', 'simplify-3to4', 'validate', 'settings']
if get_option('install-tests')
configure_file(output: t,
input: '@0@.in'.format(t),
install_subdir('simplify-data', install_dir: testexecdir)
install_subdir('simplify-data-3to4', install_dir: testexecdir)
+ install_subdir('validate-data', install_dir: testexecdir)
endif
--- /dev/null
+invalid1.ui:3:1 <child> is not a valid tag here
--- /dev/null
+<interface>
+ <child>
+ <object class="GtkLabel"/>
+ </child>
+</interface>
--- /dev/null
+invalid2.ui:4:1 <object> is not a valid tag here
--- /dev/null
+<interface>
+ <object class="GtkBox">
+ <object class="GtkButton">
+ </object>
+ </object>
+</interface>
--- /dev/null
+invalid3.ui:3:1 <object> requires attribute 'class'
--- /dev/null
+<interface>
+ <object>
+ </object>
+</interface>
--- /dev/null
+Gtk-WARNING: Failed to find accessible property “text”: Could not parse enum: 'text'
--- /dev/null
+<interface>
+ <object class="GtkBox">
+ <accessibility>
+ <property name="text">Download</property>
+ </accessibility>
+ </object>
+</interface>
--- /dev/null
+<interface>
+ <object class="GtkLabel"/>
+</interface>
--- /dev/null
+<interface>
+ <template class="GtkEmojiChooser" parent="GtkPopover">
+ </template>
+</interface>
--- /dev/null
+#! /bin/bash
+
+GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk4-builder-tool}
+TEST_DATA_DIR=${G_TEST_SRCDIR:-.}/validate-data
+TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}
+
+shopt -s nullglob
+TESTS=( "$TEST_DATA_DIR"/*.ui )
+
+echo "1..${#TESTS[*]}"
+
+I=1
+for t in ${TESTS[*]}; do
+ name=$(basename $t .ui)
+ expected="$TEST_DATA_DIR/$name.expected"
+ result="$TEST_RESULT_DIR/$name.out"
+ diff="$TEST_RESULT_DIR/$name.diff"
+ ref="$TEST_RESULT_DIR/$name.ref"
+
+ cd $TEST_DATA_DIR
+
+ $GTK_BUILDER_TOOL validate $(basename $t) 2>$result
+
+ cd $OLDPWD
+
+ if diff -u "$expected" "$result" > "$diff"; then
+ echo "ok $I $name"
+ rm "$diff"
+ else
+ echo "not ok $I $name"
+ cp "$expected" "$ref"
+ fi
+
+ I=$((I+1))
+done